<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">


<head  th:replace="include/head :: head">

</head>
<link th:href="@{css/plugins/summernote/summernote.css}" rel="stylesheet">
<link th:href="@{css/plugins/summernote/summernote-bs3.css}" rel="stylesheet">
<body class="gray-bg">


                <div class="mail-box-header">
                    <div class="pull-right tooltip-demo">
                        <a href="mailbox.html" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="存为草稿"><i class="fa fa-pencil"></i> 存为草稿</a>
                        <a href="mailbox.html" class="btn btn-danger btn-sm" data-toggle="tooltip" data-placement="top" title="放弃"><i class="fa fa-times"></i> 放弃</a>
                    </div>
                    <h2>
                    写信
                </h2>
                </div>
                <div class="mail-box">


                    <div class="mail-body">

                        <form class="form-horizontal" method="get">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">发送到：</label>
                                <div class="col-sm-10">
                                    <input type="text" id="outboxSender" class="form-control" value="i@zi-han.net">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">主题：</label>

                                <div class="col-sm-10">
                                    <input type="text" id="outboxTitle" class="form-control" value="">
                                </div>
                            </div>
                        </form>

                    </div>

                    <div class="mail-text h-200">

                        <div class="summernote" >

                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="mail-body text-right tooltip-demo">
                        <a href="javascript:void(0);" class="btn btn-sm btn-primary" data-toggle="tooltip" data-placement="top" id="send" title="Send"><i class="fa fa-reply"></i> 发送</a>
                        <a href="javascript:void(0);" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="Discard email"><i class="fa fa-times"></i> 放弃</a>
                        <a href="javascript:void(0);" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="Move to draft folder"><i class="fa fa-pencil"></i> 存为草稿</a>
                    </div>
                    <div class="clearfix"></div>



                </div>


    <div th:replace="include/foot :: foot"></div>
                <script th:src="@{js/plugins/iCheck/icheck.min.js}"></script>
     <!-- SUMMERNOTE -->
     <script th:src="@{js/plugins/summernote/summernote.min.js}"></script>
     <script th:src="@{js/plugins/summernote/summernote-zh-CN.js}"></script>
    <script>
        $(document).ready(function () {
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
            });


            $('.summernote').summernote({
                lang: 'zh-CN'
            });

        });
        var edit = function () {
            $('.click2edit').summernote({
                focus: true
            });
        };
        var save = function () {
            var aHTML = $('.click2edit').code(); //save HTML If you need(aHTML: array).
            $('.click2edit').destroy();
        };


        //发送事件
        $("#send").on('click',function () {
            if(!confirm("确定要发送吗？")) {
                return false;
            }
            var outboxSender =$("#outboxSender").val();//发送人
            var outboxTitle =$("#outboxTitle").val();//发送主题
            var outboxContent=$(".summernote").code();            //var outboxSender =$("outboxContent").text();//是否为草稿
            $.ajax({
                type:"post",
                url:"/saveOutBox",
                datatype:"json",
                data:{outboxSender:outboxSender,outboxTitle:outboxTitle,outboxContent:outboxContent},
                success:function(data){
                    if(data.code == 1){
                        alert(data.msg);
                        var userId = data.data.userId;
                        window.location="/index?userId="+userId;
                    }else{
                        alert(data.msg);
                    }
                }
            });
        })
        
        
    </script>

    <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
    <!--统计代码，可删除-->

</body>

</html>
